package edu.cornell.cs4740.wsd.test;

import static org.junit.Assert.fail;

import org.junit.Test;

import edu.cornell.cs4740.wsd.parsing.BigramDistanceContainer;
import edu.cornell.cs4740.wsd.parsing.TrainingData;
import edu.cornell.cs4740.wsd.parsing.WordDistanceContainer;


public class TrainingDataTester {

	@Test
	public void testWithStemming() {
		String s = "begin.v 0 1 0 0 0 @ It is important to agree on , and understand the limit of the works that are being done before work starts . The Environmental Health Officer will however carry out a Financial Test of resources to determine how much , if anything , you are expected to pay towards the reasonable costs . He/she will tell you how much this is at the @beginning@ so you know at the start how much you have to pay . You will then need to gather together the necessary things to make an application . How do I raise the money I am to pay ?";
		try {
			TrainingData td = new TrainingData(s, false);
			System.out.println(s);
			for(WordDistanceContainer wdc : td.getPreceedingWords()) {
				System.out.println(wdc.toString());
			}
			
			System.out.println("Succeeding words");
			for(WordDistanceContainer wdc : td.getSucceedingWords()) {
				System.out.println(wdc.toString());
			}
		} catch (Exception e) {
			e.printStackTrace();
			fail("Exception");
		}
	}


	@Test
	public void testWithoutStemming() {
		String s = "begin.v 0 1 0 0 0 @ It is important to agree on , and understand the limit of the works that are being done before work starts . The Environmental Health Officer will however carry out a Financial Test of resources to determine how much , if anything , you are expected to pay towards the reasonable costs . He/she will tell you how much this is at the @beginning@ so you know at the start how much you have to pay . You will then need to gather together the necessary things to make an application . How do I raise the money I am to pay ?";
		try {
			TrainingData td = new TrainingData(s, true);
			System.out.println(s);
			for(WordDistanceContainer wdc : td.getPreceedingWords()) {
				System.out.println(wdc.toString());
			}
			
			System.out.println("Succeeding words");
			for(WordDistanceContainer wdc : td.getSucceedingWords()) {
				System.out.println(wdc.toString());
			}
		} catch (Exception e) {
			e.printStackTrace();
			fail("Exception");
		}
	}
	
	@Test
	public void testThatTrainingDataBigramsAreRight() {
		String s = "begin.v 0 1 0 0 0 @ It is important to agree on , and understand the limit of the works that are being done before work starts . The Environmental Health Officer will however carry out a Financial Test of resources to determine how much , if anything , you are expected to pay towards the reasonable costs . He/she will tell you how much this is at the @beginning@ so you know at the start how much you have to pay . You will then need to gather together the necessary things to make an application . How do I raise the money I am to pay ?";
		try {
			TrainingData td = new TrainingData(s, false);
			
			System.out.println(td.getPreceedingBigrams().size());
			for(BigramDistanceContainer bdc : td.getPreceedingBigrams()) {
				System.out.println(bdc.toString());
			}
			System.out.println(td.getSucceedingBigrams().size());
			for(BigramDistanceContainer bdc : td.getSucceedingBigrams()) {
				System.out.println(bdc.toString());
			}
		} catch(Exception e) {
			e.printStackTrace();
			fail("Exception");
		}
	}
	
	@Test
	public void sanityTestOfBaselinePredictor() {
		
	}
}
